package com.wc5818.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wc5818.entity.User;
import com.wc5818.mapper.UserMapper;

/**
 * @Author:yqb
 * @Date: 2020/01/09
 * @Time: 15:20 user 业务处理类
 * 
 */
@Service
public class UserService implements UserMapper {
	@Autowired
	UserMapper userMapper;

	
	

	/***
	 ****
	 * 根据code 获取 username数据password判断是否登录
	 * selUserUserAnPassLogin
	 * 
	 * 
	 *
	 * @param username
	 * @param pass
	 * @return
	 */
	@Override
	public List<User> selUserUserAnPassLogin(String username, String pass){
		return userMapper.selUserUserAnPassLogin(username,pass);
	}
	
	
	/****
	 * 根据code 获取 user数据
	 * 
	 * @return
	 */
	@Override
	public List<User> selAllUserCode(String code){
		
		return userMapper.selAllUserCode(code);
		
	}
	
	/***
	 * 根据username获取相关数据
	 * 
	 * @param username
	 * @return
	 */
	@Override
	public User sel(String username) {
		return userMapper.sel(username);
	}

	/**
	 * 查询所有用户
	 * 
	 * @return
	 */
	@Override
	public List<User> findAllUser() {
		return userMapper.findAllUser();
	}

	/**
	 * 保存user
	 * 
	 * @param u
	 * @return
	 */
	@Override
	public int insert(User u) {

		return userMapper.insert(u);

	}

	/***
	 * 
	 * 根据Code获取相关数据是否存在
	 * 是否存在
	 * @param code
	 * @return
	 * 
	 */
	@Override
	public List<User> selForCode(String code) {

		return userMapper.selForCode(code);

	}
}
